<#assign path = request.getContextPath()>
<#assign basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/">

<!DOCTYPE HTML>
<html>
<head>
    <title>WebDesign Student - Changepwd</title>

 <meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- bootstrap -->
<link href="${path}/css/bootstrap/bootstrap.css" rel="stylesheet" />
<link href="${path}/css/bootstrap/bootstrap-responsive.css" rel="stylesheet" />
<link href="${path}/css/bootstrap/bootstrap-overrides.css" type="text/css" rel="stylesheet" />

<!-- libraries -->
<link href="${path}/css/lib/font-awesome.css" type="text/css" rel="stylesheet" />

<!-- global styles -->
<link rel="stylesheet" type="text/css" href="${path}/css/layout.css" />
<link rel="stylesheet" type="text/css" href="${path}/css/elements.css" />
<link rel="stylesheet" type="text/css" href="${path}/css/icons.css" />

<!-- this page specific styles -->
<link rel="stylesheet" href="${path}/css/compiled/index.css" type="text/css" media="screen" />

<!-- open sans font -->
<link
	href='http://fonts.useso.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800'
	rel='stylesheet' type='text/css' />

<!-- lato font -->
<link
	href='http://fonts.useso.com/css?family=Lato:300,400,700,900,300italic,400italic,700italic,900italic'
	rel='stylesheet' type='text/css' />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<!-- navbar -->
<div class="navbar navbar-inverse">
    <div class="navbar-inner">
        <a class="brand" href="#"><img src="${path}/img/logo-login.png"/></a>

        <ul class="nav pull-right">
            <li>
            	<a href="${path}/stu/homeworkState">
                	${username}
                </a>
            </li>
            <li>
				<a href="${path}/common/homeworkDisplay">
                        	查看展示作业　　
                      <!--  <b class="caret"></b>--><!--三角箭头-->
                </a>
            </li>
            <div class="copyrights"></div>
            <li class="hidden-phone">
				<a href="${path}/stu/changePwd">
                       	修改密码
                </a>
            </li>

            <li class="hidden-phone">
            	<a href="${path}/common/logout"><!--跳转到signin.html页面-->                       
                      	 注销
                </a>
            </li>
		</ul>            
	</div>
</div>
<!-- end navbar -->

<!-- main container -->
	<div class="contentt">
		<div class="container-fluid">
		<div class="span12" style="margin-top:50px">
					<h3 class="name">修改密码</h3>
					<hr />
		</div>
			<div id="pad-wrapper">
				
				<div style="margin-top:150px">
					<form action="#" method="post">
						<table>
							<tr style="margin-bottom:20px;font-size:13px;">
								<td><label>用户名：</label></td>
								<td><label style="font-size:13px;">${username}</label></td>
							</tr>
							<tr style="margin-bottom:20px;font-size:13px;font-weight:bold;">
								<td>
									<label>原密码：</label>
								</td>
								<td>
									<input type="password" name="password" id="password">
									<span class="note2" style="display:none;">请输入原密码！</span>
								</td>
							</tr>
							<tr style="margin-bottom:20px;font-size:13px;font-weight:bold;">
								<td>
									<lable for="pwd">新密码：</lable>
								</td>
								<td>
									<input type="password" name="newpwd" class="input" maxlength="29" id="pwd"/>
									<span class="note1" style="display:none;">请输入新密码！</span>
									<span class="note3" style="display:none;">原密码与新密码一致！</span>
								</td>
							</tr>
							<tr style="margin-bottom:20px;font-size:13px;font-weight:bold;">
								<td>
									<lable for="new_pwd">确认密码：</lable>
								</td>
								<td>
									<input type="password" class="input" maxlength="29" id="new_pwd">
									<span class="note" style="display:none;">两次密码不一致！</span>		
								</td>
							</tr>
							<tr>
								<td colspan="2">
								<input type="button" style="margin-left:70%" class="btn-glow primary" value="保存" id="btn"/>
								</td>
							</tr>
						</table>
					</form>
				</div>
			</div>
		</div>
	</div>
	



<!-- scripts -->
<script src="${path}/js/jquery-latest.js"></script>
<script src="${path}/js/bootstrap.min.js"></script>
<script src="${path}/js/theme.js"></script>

<script type="text/javascript">

$("#btn").click(function(){

	var pwd = $("#pwd").val();
	
	var new_pwd = $("#new_pwd").val();
	
	var password = $("#password").val();
	
	if(password == ""){
		$(".note2").show();
	}
	else{
		if(pwd == ""){
			$(".note1").show();
		}else{
			if( pwd != new_pwd ){
				$(".note").show();
			}
			else if(password == pwd){
				$(".note3").show();
			}
			else{
				$.ajax({
					url : "${path}/ajax/stuRewrite",
					data: {password:password, newpwd: pwd},
					type : "post",
					dataType : "json",
					error : function() {
						$('#SecondList').append('请求出错！');
					},
					success : function(responseResult) {
						if(responseResult.flag == "success"){
							alert("修改成功！");
						}else if(responseResult.flag == "wrong"){
							alert("原密码错误！");
						}
					}
				});
			}
		}
	}
});

</script>
</body>
</html>